package com.logansoft.zhxypkoa.repository.sys;

import java.util.Optional;

import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;

import com.logansoft.zhxypkoa.domain.sys.Role;

@RepositoryRestResource(collectionResourceRel = "roles", path = "roles")
public interface RoleRepository extends JpaRepository<Role, String> {
	@Cacheable(value = "roles", key = "#p0")
	@Override
	Page<Role> findAll(Pageable pageable);
	@CacheEvict(value = "roles", key = "#p0.id", allEntries = true)
	@Override
	<S extends Role> S save(S entity);
	@Cacheable(value = "roles", key = "#p0")
	@Override
	Optional<Role> findById(String id);
	@CacheEvict(value = "roles", key = "#p0", allEntries = true)
	@Override
	void deleteById(String id);
	@CacheEvict(value = "roles", key = "#p0.id", allEntries = true)
	@Override
	void delete(Role entity);
}